package com.ljs.mongodemo.demo.service;

import com.ljs.mongodemo.demo.bean.User;
import com.mongodb.client.result.DeleteResult;
import com.mongodb.client.result.UpdateResult;
import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.core.aggregation.AggregationResults;
import org.springframework.data.mongodb.core.query.Criteria;

import java.util.List;

public interface MongodbUserService {
    void saveUser(User user);

    DeleteResult deleteUser(String id);

    List<User> findUser(String userName, String note, int curpage, int limit);

    UpdateResult updateUser(User user);

    User getUser(String id);

    /**
     * 通过名称来查
     * @param userName
     * @return
     */
    User getUserByname(String userName);
    List<User> findall(int curpage, int limit);

    /**
     * 分组查询
     * @param pageNum
     * @param pageSize
     * @param criteria1
     * @param criteria2
     * @param field1
     * @param field2
     * @param sortName
     * @param sort
     * @param collectionName
     * @return
     */
        AggregationResults aggregation(int pageNum, int pageSize, Criteria criteria1, Criteria criteria2, String field1, String field2, String sortName, Sort sort, String collectionName);

    /**
     * 根据type来查
     * @param type
     */
//    List<User>  selbyType(String type);

}
